﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 简易计算器
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            show();
        }
        public void show()
        {
            string first = this.input1.Text.Trim();
            string second = this.input2.Text.Trim();
            string FuHao = this.yunSuanFu.Text.Trim();
            //将输入存值
            double num1 = Convert.ToDouble(first);
            double num2 = Convert.ToDouble(second);
            this.textBox1.Text = (num1 + num2).ToString();
            switch(FuHao)
            {
                case "+":
                    this.textBox1.Text = (num1 + num2).ToString();
                    break;
                case "-":
                    this.textBox1.Text = (num1 - num2).ToString();
                    break;
                case "*":
                    this.textBox1.Text = (num1 * num2).ToString();
                    break;
                case "/":
                    this.textBox1.Text = (num1 / num2).ToString();
                    break;
            }
        }
    }
}
